//分类小仓库
import request from '../../api/request.js'

const state={
	bannerList: [],
	goodsList:[],
}

const actions={
	//所有商品数据
  async	goodsList(context){
	  let res= await request({
		  url:'/category/top',
		  method:'get'
	  })
	  
	  context.commit('GOODSLIST',res.result)
  },
  // 轮播图
  async bannerList(context) {
  	let result = await request({
  		method: "get",
  		url: "/home/banner",
  	})
  	context.commit('BANNERLIST',result.result)
  },
}

const mutations={
	//所有商品数据
	GOODSLIST(state,data){
		state.goodsList=data
		
	},
	//轮播图
	BANNERLIST(state, data) {
		state.bannerList = data
	},
}

const getters={
	
}

export default {
	
	namespaced:true,
	state,
	actions,
	mutations,
	getters
}